<?php
class database
{
	var $sql = '';
	var $result = '';
	public function __construct($host, $user, $pass, $database, $port)
	{
		if(!@mysql_connect($host.':'.$port, $user, $pass))
		{
			error::show(0);
			exit(1);
		}

		if(!@mysql_select_db($database))
		{
			error::show(1);
			exit(1);
		}
		
		$this->sql = array();
	}
	
	function setCharacter($character)
	{
		$this->query("SET CHARACTER SET $character");
	}
	
	function query($query)
	{
		$this->sql[] = $query;
		if(!$this->result=mysql_query($query))
		{
			error::show(7);
			$this->debug();
			return false;
		}
      return $this->result;
	}
   
	public function getReturn()
   {
      return $this->result;
   }
	function getResult()
	{
		return mysql_fetch_array($this->result);
	}
	
	function debug()
	{
		echo 'QUICK QUERYS DEBUGE INFORMATION:<br><pre>';
		print_r($this->sql);
		echo '</pre>';
	}
}
?>